﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Adding
using System.Data;
using System.Configuration;
using KPIS.DBM;
using KPIS.GERP.GFMS.MODEL;

namespace KPIS.GERP.GFMS.DAL
{
    public class D_FIM_MAS_InvoiceList
    {
        DBManager dbManager = new DBManager(SystemInfo._DataProvider, ConfigurationSettings.AppSettings["ConnectionString"].ToString());
        ConvertNullable cn = new ConvertNullable();

        public IList<M_FIM_MAS_InvoiceList> GetFull()
        {
            string strSQL;
            DataRowCollection drc = null;
            IList<M_FIM_MAS_InvoiceList> infoList = new List<M_FIM_MAS_InvoiceList>();

            try
            {
                dbManager.Open();

                strSQL = "SELECT * FROM fim_mas_invoice_list ORDER BY fim_mas_invoice_list.invoicelist_seq ASC";

                drc = dbManager.ExecuteDataSet(CommandType.Text, strSQL).Tables[0].Rows;

                if (drc.Count > 0)
                {
                    for (int i = 0; i < drc.Count; i++)
                    {
                        M_FIM_MAS_InvoiceList info = new M_FIM_MAS_InvoiceList();

                        info.invoicelist_id = Convert.ToInt32(drc[i]["invoicelist_id"]);
                        info.invoicelist_seq = cn.ConvertNullInt(drc[i]["invoicelist_seq"]);
                        info.invoicelist_name = drc[i]["invoicelist_name"].ToString();

                        infoList.Add(info);
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            finally
            {
                dbManager.Dispose();
            }

            return infoList;
        }
    }
}
